package com.powerunion.datacollection.common;

import java.sql.*;
import java.util.*;

public class BsResponse implements java.io.Serializable {
	public static final int FATAL_ERR_FLAG = -1000;
	public static final int SUCCEED_FLAG = 1;
	public static final String SUCCEED_MSG = "ok";
	private int returnFlag = 0;
	private String returnMsg = "";
	private Map BsResponse;

	public BsResponse() {
		BsResponse = new HashMap();
	}

	public void clear() {
		BsResponse.clear();
	}

	public void setValue(String valueName, Object data) {
		BsResponse.put(valueName, data);
	}

	public Object getValue(String valueName) {
		return BsResponse.get(valueName);
	}

	public String getValueAsString(String valueName) {
		return (String) getValue(valueName);
	}

	public Integer getValueAsInteger(String valueName) {
		return (Integer) getValue(valueName);
	}

	public Long getValueAsLong(String valueName) {
		return (Long) getValue(valueName);
	}

	public List getValueAsList(String valueName) {
		return (List) getValue(valueName);
	}

	public Map getValueAsMap(String valueName) {
		return (Map) getValue(valueName);
	}

	public Time getValueAsTime(String valueName) {
		return (Time) getValue(valueName);
	}

	public java.util.Date getValueAsDate(String valueName) {
		return (java.util.Date) getValue(valueName);
	}

	public Timestamp getValueAsTimestamp(String valueName) {
		return (Timestamp) getValue(valueName);
	}

	/**
	 * finalize
	 *
	 * @throws Throwable
	 * @todo Implement this java.lang.Object method
	 */
	protected void finalize() throws Throwable {
		if (!BsResponse.isEmpty()) {
			BsResponse.clear();
			BsResponse = null;
		}
		super.finalize();
	}

	public int getReturnFlag() {
		return returnFlag;
	}

	public String getReturnMsg() {
		return returnMsg;
	}

	public void setReturnFlag(int returnFlag) {
		this.returnFlag = returnFlag;
	}

	public void setReturnMsg(String returnMsg) {
		this.returnMsg = returnMsg;
	}
}
